package com.tarena.test;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.Scanner;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class JFrameDemo {
	public static void main(String[] args) throws IOException{
		Class cls = JFrameDemo.class;
		URL url = cls.getResource("fuck.png");
		ImageIcon img = new ImageIcon(url);
		url=cls.getResource("/com/tarena/test/new.txt");
		InputStream in = url.openStream();
		//Scanner s = new Scanner(in);
		//String txt = s.nextLine();
		String txt=IOUtils.readLine(in,"gbk");
		//s.close();
		JFrame frame = new JFrame("test");
		JPanel panel = new JPanel();
		JLabel label = new JLabel(img);
		JLabel text = new JLabel(txt);
		panel.add(label);
		panel.add(text);
		frame.add(panel);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setVisible(true);
		frame.setSize(300,500);
	}
}
